﻿Imports System.Runtime.CompilerServices

Module ExceptionSeverityExtensions

  ''' <summary>
  ''' Converts the specified <see cref="ExceptionSeverity">Exception Severity</see> enumeration value to a <see cref="Int16">Int16</see> value.
  ''' </summary>
  ''' <param name="Value">The <see cref="ExceptionSeverity">ExceptionSeverity</see> value to convert.</param>
  ''' <returns>The <see cref="Int16">Int16</see> value that represents the specified <see cref="ExceptionSeverity">ExceptionSeverity</see>.</returns>
  ''' <revisions>
  '''   <revision date="12/14/2008" author="Chad Green" version="1.00.00.000">Initial Development</revision>
  ''' </revisions>
  <Extension()> Public Function ToInt16(ByVal Value As ExceptionSeverity) As Int16
    Select Case Value
      Case ExceptionSeverity.Critical
        Return Convert.ToInt16(1)
      Case ExceptionSeverity.Warning
        Return Convert.ToInt16(2)
      Case ExceptionSeverity.Validation
        Return Convert.ToInt16(3)
      Case ExceptionSeverity.Information
        Return Convert.ToInt16(4)
      Case Else
        Throw New InvalidCastException("The specified value is not value.")
    End Select
  End Function

End Module
